import Socket from "./socket";
import wsEvent from "./event/wsEvent"
function useWsSocket () {
  const ws = new Socket({
    onConnect: (ops) => wsEvent.onConnect(ops),
    onMessage: (ops) => wsEvent.onMessage(ops),

  })

  // ws.on("logout",(ops) => msEvent.logout(ws.exit.bind(ws),ops) )
  //   .on("authLogout",(ops) => msEvent.authLogout(ws.exit.bind(ws),ops))
    

  return {
    send: (ops,cb) => ws.send(ops,cb),
    exit: () => ws.exit()
  }
}

export default useWsSocket